<?php
$page = !($_GET['page'])?'1':intval($_GET['page']);
$page2=($page-1)*10;
$pagesize=10;

$kword=$_GET['mallid'];
if($kword==''){
    $where_and='';
}
elseif($kword>0){
    $where_and="where mallid='$kword'";
}

$sql="select count(*) as totalnum from ".$BIAOTOU.$table." $where_and  order by id desc";
$rsnum = mysql_query($sql);
$rownum = mysql_fetch_array($rsnum);
$total=$rownum["totalnum"];

$sql="select * from ".$BIAOTOU.$table." $where_and  order by id desc limit $page2,$pagesize";
$rs = mysql_query($sql);

$sql="select id,name from ".$BIAOTOU."mall order by catid";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query)){
    $mall_arr[$row['id']]=$row['name'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Pragma" contect="no-cache"> 
<title>管理中心</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
<link media="screen" rel="stylesheet" href="../../css/colorbox.css" />
<style type="text/css">
<!--
.STYLE1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
.STYLE2 {
	color: #555555;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
-->
</style>
</head>

<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" style="text-align:center">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td width="358" height="30" align="left" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="../images/arrow.gif" width="16" height="22" align="absmiddle" /> 内容管理 [ <a href="admin.php?act=addedi" class="link3">发布内容</a> ] </strong></td>
              <form id="form1" name="form1" method="get" action="">
              <input type="hidden" name="act" value="list"  />
              <td width="479" align="left" bgcolor="E9F2FB" class="bigtext">
              商城：<?=select($mall_arr,"mallid",$kword,500)?>
                <input type="submit" value="查找" />
                <a href="admin.php?act=list">全选</a>
                </td></form>
              <td width="130" height="30" align="right" bgcolor="E9F2FB" class="bigtext">共有 <b><?php echo $total;?></b> 条记录&nbsp;&nbsp;</td>
            </tr>
            <tr>
              <td colspan="3" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><table width="100%" border=1 cellpadding=0 cellspacing=0
style="border-collapse: collapse" bordercolor="#dddddd">
                    <tr>
                      <td width="" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;活动名</strong></td>
                      <td width="10%" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;商城</strong></td>
                      <td width="12%" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;活动图片</strong></td>
                      <td width="12%" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;开始时间</strong></td>
                      <td width="12%" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;结束时间</strong></td>
                      <td width="5%" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;排序</strong></td>                     
                      <td width="8%" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;修改</strong></td>
                      <td width="12%" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>&nbsp;时间</strong></td>
                    </tr>
                    <?php
					while ($row = mysql_fetch_array($rs))
					{
						echo "<tr>";
                      	echo "<td height=30 class=bigtext>&nbsp;<a href='".$row["url"]."' target='_blank'>".$row["name"]."</a></td>";
						echo "<td height=30 class=bigtext>&nbsp;".$row["mallname"]."</td>";
                      	echo "<td height=30 class=bigtext>&nbsp;<img height='30px' width='60px' src=".$row["pic"]." /></td>";
						echo "<td height=30 class=bigtext>&nbsp;".$row["stime"]."</td>";
						echo "<td height=30 class=bigtext>&nbsp;".$row["etime"]."</td>";
						echo "<td class=bigtext id=ss>&nbsp;".$row["sort"]."</td>";	
						echo "<td class=bigtext>&nbsp;<a href=admin.php?act=addedi&id=".$row["id"]."&mallid=".$kword." class=link4>修改</a> <a href=admin.php?act=del&id=".$row["id"]."&mallid=".$kword." class=link4 onclick='return confirm(\"确定要删除?\")' >删除</a></td>";
						echo "<td class=bigtext align=center>&nbsp;".$row["time"]."</td>";	
						echo "</tr>";
					}
					?>
                    <tr>
                      <td height="43" colspan="11" align="center"><div class="yahoo2" id="pages">
                          <?php  pageft($total,$pagesize,1,1,0,10,"admin.php?act=list&mallid=".$kword);echo $pagenav;?>
                      </div></td>
                    </tr>
                  </table></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
</body>
</html>